// 引入axios
import request from '@/utils/request'
import type { trademark, trademarkResponseData } from './model/trademark'

// 枚举
enum API {
    TRADEMARKLIST = '/admin/product/baseTrademark/',
    UPDATETRADEMARK = '/admin/product/baseTrademark/update',
    ADDTRADEMARK = '/admin/product/baseTrademark/save',
    DELETETRADEMARK='/admin/product/baseTrademark/remove/'
}

// 获取品牌数据的接口
export const reqTrademarkList = (page:number,limit:number)=>request.get<any,trademarkResponseData>(API.TRADEMARKLIST + `${page}/${limit}`)

// 添加|修改品牌的接口
export const reqAddOrUpdateTrademark = (data:trademark)=>{
    if(data.id){
        return request.put<any,any>(API.UPDATETRADEMARK,data)
    }else{
        return request.post<any,any>(API.ADDTRADEMARK,data)
    }
}

// 删除品牌的接口,携带 id 参数
export const reqDeleteTrademark = (id:number)=>request.delete<any,any>(API.DELETETRADEMARK+id)